/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.colegiatura.bc;

import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.cip.esymons.colegiatura.be.VinculoColegiado;

/**
 *
 * @author ADMINISTRADOR
 */
public class VinculoColegiadoDelegate {

    private VinculoColegiadoFacadeLocal local;

    public VinculoColegiadoDelegate() {

        local = lookupVinculoColegiadoFacade();
    }

    public void create(VinculoColegiado vinculoColegiado){

        local.create(vinculoColegiado);
    }

    public void edit(VinculoColegiado vinculoColegiado){

        local.edit(vinculoColegiado);
    }

    public void remove(VinculoColegiado vinculoColegiado){

        local.remove(vinculoColegiado);
    }

    public VinculoColegiado find(Object id){

        return local.find(id);
    }

    public List<VinculoColegiado> findAll(){

        return local.findAll();
    }

    public List<VinculoColegiado> listaVinculos(Long codigo){

        return local.listaVinculos(codigo);
    }

    private VinculoColegiadoFacadeLocal lookupVinculoColegiadoFacade() {
        try {
            Context c = new InitialContext();
            return (VinculoColegiadoFacadeLocal) c.lookup("java:comp/env/VinculoColegiadoFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }



}
